import useInterval from '../../../examples/files/hooks/useInterval.js'

We can compose built-in hooks to create new ones. We should still use the `use` prefix for our function name.

> We'll see another example of a custom hook when building a drag gesture with [PanResponder](/app/gestures/pan_responder).

## Example

Here we make a `useInterval` hook for running a function on a regular interval. It can be deceptively difficult to implement correctly - we should be able to change the delay and callback function at any point.

> Example custom hook from: https://overreacted.io/making-setinterval-declarative-with-react-hooks/

<Example title="useInterval" code={useInterval} />
